package com.feng.service.user;

import com.feng.dao.BaseDao;
import com.feng.dao.user.UserDao;
import com.feng.dao.user.UserDaoImpl;
import com.feng.pojo.User;
import org.junit.Test;

import java.sql.Connection;

public class UserServiceImpl implements UserService {
    private UserDao userDao;

    public UserServiceImpl() {
        userDao = new UserDaoImpl();
    }

    public User queryUser(String username,String password) {

        Connection connection = null;
        User user = null;

        try {
            connection = BaseDao.getConnection();
            user = userDao.queryUser(connection, username,password);
        } catch (Exception e) {
            e.printStackTrace();
        }

        BaseDao.CloseResources(connection, null, null);

        return user;
    }

    @Test
    public void test() {

        System.out.println(queryUser("qq1234567","111111"));
    }

}
